'''
Created on Jul 14, 2010

@author: Aidamina
'''
import lib
from google.appengine.ext import db
import os
class Entity(db.Model):
    '''
    classdocs
    '''
    version = db.StringProperty(default=os.environ.get('CURRENT_VERSION_ID','0'))
    userModified = db.UserProperty(auto_current_user=True)
    userCreated = db.UserProperty(auto_current_user_add=True)
    dateModified = db.DateTimeProperty(auto_now=True)
    dateCreated = db.DateTimeProperty(auto_now_add=True)
    '''
    def put(self):
        super(Entity,self).put()
        props = self.properties()
        from lib.text import LocalizedTextProperty
        for prop in props:            
            if props[prop].__class__==LocalizedTextProperty:
                LocalizedTextProperty.__get__(props[prop], self, self.__class__).put()
    '''
    def delete(self):
        props = self.properties()
        for prop in props:
            if props[prop].__class__==lib.LocalizedTextProperty:
                lib.LocalizedTextProperty._delete(props[prop], self)
        super(Entity,self).delete()
        
    def __init__(self, *args, **kwargs):
        super(Entity, self).__init__(*args, **kwargs)
    